<?php

class FriendRequestAction extends SzAbstractAction
{
    Protected $paramTypes = array(
        SzAbstractAction::TYPE_INT,
        SzAbstractAction::TYPE_STRING,
        SzAbstractAction::TYPE_INT,
    );

    /**
     * 申请好友
     *
     * @param int $userId
     * @param string $friendCode
     * @param int $reqTime
     * @return SzResponse
     */
    public function execute($userId, $friendCode, $reqTime)
    {
        if (!GameService::get()->verifySysUnlock($userId, GameConst::FUNC_FRIEND_FUNC)) {
            return $this->buildResponse(false);
        }

        return $this->buildResponse(
            FriendService::get()->requestFriend($userId, $friendCode, $reqTime)
        );
    }
}